import { Hero } from 'src/app/page/hero/hero';
import { Component, OnInit } from '@angular/core';
import { HeroService } from 'src/app/service/hero/hero.service';

@Component({
  selector: 'app-dashboard',
  templateUrl: './dashboard.page.html',
  styleUrls: ['./dashboard.page.scss']
})
export class DashboardPage implements OnInit {
  heroes: Hero[] = [];
  constructor(private heroService: HeroService) {}
  ngOnInit() {
    this.getHeroes();
  }
  getHeroes(): void {
    this.heroService
      .getHeroesForHttp()
      .subscribe(heroes => (this.heroes = heroes.slice(0, 8)));
  }
  
}
